package com.abocode.aichat.core.interfaces.constant;

import com.abocode.aichat.utils.SystemUtils;

/**
 * Created by guanxf on 2015/8/10.
 */
public class ApplicationCostant {
    //消息是离线
    public static String MESSAGE_IS_OFFLINE="isOffline";
    //消息保存开关打开
    public static String MESSAGE_STORE_SWITCH_IS_ON="on";
    //默认打招呼条数
    public static int MESSAGE_Hi_NUM=10;
    public static String JID_ENCRYPT_KEY="online%^";
    public final static class ApplicationConfig{
        /**
         *   获取消息开关是否打开
         */
        public final static  Boolean getMessageStoreSwitch(){
              if (SystemUtils.getProperty("message.store.switch").equals(ApplicationCostant.MESSAGE_STORE_SWITCH_IS_ON)){
                  return true;
              }
            return false;
         }

    }

    public final static class BusinessConfig{
        public static String USER_STATUS_IS_LOCKED="0";
        /**
         * 无限聊天模式
         */
        public static long USER_PERMISSION_CHAT_IS_NOLIMIT=8;
        /***
         * 配置类型为聊天
         */
        public static String CONFIG_TYPE_IS_CHAT="chat";

        /***
         * 是否有相应的权限
         * @param user
         * @param permission
         * @return
         */
        public static boolean hasPermission(long user, long permission) {
            return (user & permission) == permission;
        }
    }
}
